# pythonchallenge.com scripts
# #1: http://www.pythonchallenge.com/pc/def/map.html

# globals
alphabet = 'abcdefghijklmnopqrstuvwxyz'


def char2num(char):
  num = -1    # return
  for i in range(26):
    if alphabet[i] == char:
      return i
  return num
      
      
def num2char(num):
  num = num % 26
  return alphabet[num]
      
      
def transform(char):
  new_char = ''   # return
  if not char in alphabet:
    return char
  ncnum = char2num(char) + 2
  new_char = num2char(ncnum)
  return new_char
  
  
def implode(Lst):
  return reduce((lambda s1,s2: s1+s2), Lst)
  
    
def translate(text=1):
  translation = ''  # return
  
  if text == 1:
    plaintext = "g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc\
dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle.\
sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."

  else:    
    plaintext = "map"
    
  TransList = map(transform, plaintext)
  translation = implode(TransList)  
  return translation
  
